//package com.angel.bo.auth.client.config.security;
//
//import com.alibaba.fastjson.JSON;
//import com.angel.bo.common.msg.WebReturn;
//import org.springframework.http.HttpStatus;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.web.AuthenticationEntryPoint;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * @author zhangwei
// * @date 2018/4/27 11:53
// * @desc 自定义登录未通过校验事件,
// * 通过返回自定义信息代替默认的页面跳转
// * 当用户未通过登录验证时,执行下面方法
// */
//@Component
//public class GoAuthenticationEntryPoint implements AuthenticationEntryPoint {
//
//    @Override
//    public void commence(HttpServletRequest httpServletRequest, HttpServletResponse response, AuthenticationException e) throws IOException {
//        WebReturn<Object> message = new WebReturn<>(HttpStatus.FORBIDDEN + "", "TOKEN失效,请重新登录");
//        response.setStatus(HttpStatus.UNAUTHORIZED.value());
//        response.setHeader("Content-Type", "application/json;charset=utf-8");
//        response.getWriter().print(JSON.toJSONString(message));
//        response.getWriter().flush();
//    }
//}
